package com.zzx.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zzx.model.User;
import com.zzx.service.IUserService;
@Controller  
@RequestMapping("/user")  
public class UserController {
	private static Logger log=LoggerFactory.getLogger(UserController.class);
	@Resource  
	private IUserService userService;

	@RequestMapping(value="/test.do",method=RequestMethod.GET)  
	public String test(HttpServletRequest request,User model){  
        int userId = Integer.parseInt(request.getParameter("id"));  
        String userName = request.getParameter("userName");  
        System.err.println("************userId:"+userId);
        System.err.println("***********userName:"+userName);
       // User user=null;
        /*if (userId==1) {
             user = new User();  
             user.setAge(11);
             user.setId(1);
             user.setPassword("123");
             user.setUserName("javen");
        }*/
       
        log.debug(model.toString());
       // model.addAttribute("user", model);  
        System.err.println("***user*编号**"+model.getId());
        System.err.println("***user*名称**"+model.getUserName());
        Map<String,String> map = new HashMap<String,String>();
        List<Map<String,String>> list = this.userService.queryUserList(map);
        System.err.println("**sql***"+list.toString());
        return "index";  
    } 
}
